import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter);

import Home from '@/page/home/Home.vue';

// import Index from '@/components/home/Index.vue';
// import Article from '@/components/home/article/Article.vue';
// import ArticleEdit from '@/components/admin/ArticleEdit.vue';
const router = new VueRouter({
    mode: 'history',
    //abstract:true,
    base:process.env.NODE_ENV == 'production'?'/index':'',
    //scrollBehavior:true,
    routes: [
       { path: '/', redirect: '/index' },
        {
            path: '/',
            component: Home,
            children: [{
                name: 'index',
                path: '/index',
                component: resolve => require(['@/page/home/Index.vue'], resolve)
            }, {
                name: 'post',
                path: '/post/:cid?/:id',
                component:resolve => require(['@/page/home/post/Post.vue'], resolve)
                // component: Article
            },{
                name: 'postList',
                path: '/list/post',
                component:resolve => require(['@/page/home/post/List.vue'], resolve)
                // component: Article
            },{
                name: 'about',
                path: '/about',
                component:resolve => require(['@/page/home/About.vue'], resolve)
                // component: Article
            }]
        },
        {
            name: 'postEdit',
            path: '/edit/post/:cid?/:id?',
            component:resolve => require(['@/page/admin/PostEdit.vue'], resolve)
            // component: ArticleEdit
        },
        
    ]
})
export default router;